********************************************************************************
* appendix table 5: dd results with 400m radius

********************************************************************************

cd "$main_dir/data"

* near far 400
local max_dist 600
local iso_dist 400 
local g g 

use near_far_m`max_dist'_i`iso_dist'_`g',clear

gen treated=l400
gen treated_after=treated*(gap>=0)

egen ring_fe=group(building_id l400)

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 & tx400_min_number>0 & tx46_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(ring_fe building_id_year) vce(cl building_id)


*  near-near 400

local max_dist 400
local g g

use near_near_m`max_dist'_i`max_dist'_`g',clear

reghdfe lrent treated_after /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & min_number>0 

* ddd 400
		
use triple_diff_m600_i400_g,clear

egen ring_fe=group(building_id l400)

reghdfe lrent treated l400 treated#l400 listing_year#l400 after_400_treated i.listing_bedrooms i.listing_bathrooms  ///
	if building_sample==1 & tx400_min_number>0  & tx46_min_number>0  ///
	[aweight=building_sample_weight],absorb(ring_fe building_id_year) vce(cl building_id)

capture drop building_tag
egen building_tag=tag(building_id)
tab treated if building_tag==1 & building_sample==1 & tx400_min_number>0 & tx46_min_number>0

